/*
 *   A task scheduler that implements Monte-Carlo simulation
 *
 *   Copyright (C) 2011 Systasis Computer Systems, Inc.
 *
 *   This program is free software: you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License as published by
 *   the Free Software Foundation, either version 3 of the License, or
 *   (at your option) any later version.
 *
 *   This program is distributed in the hope that it will be useful,
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *   GNU General Public License for more details.
 *
 *   You should have received a copy of the GNU General Public License
 *   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *   
 *   $Id: MenuPresenter.java 82 2011-08-07 17:35:42Z jchimene@gmail.com $
 */
package com.systasis.sked.client.presenter;

import com.google.gwt.event.shared.EventBus;
import com.google.gwt.user.client.ui.Widget;
import com.google.inject.Inject;
import com.google.inject.Singleton;
import com.gwtplatform.mvp.client.HasUiHandlers;
import com.gwtplatform.mvp.client.Presenter;
import com.gwtplatform.mvp.client.View;
import com.gwtplatform.mvp.client.annotations.ProxyCodeSplit;
import com.gwtplatform.mvp.client.proxy.Proxy;

@Singleton
public class MenuPresenter extends Presenter<MenuPresenter.MyView, MenuPresenter.MyProxy> implements MenuUiHandlers {

    @ProxyCodeSplit
    public interface MyProxy extends Proxy<MenuPresenter> {
    }

    public interface MyView extends View, HasUiHandlers<MenuUiHandlers> {
	void startProcessing();
    }

    final private GanttPresenter ganttPresenter;

    @Inject
    public MenuPresenter(final EventBus eventBus //
	    , final MyView view //
	    , final MyProxy proxy //
	    , final GanttPresenter ganttPresenter) {
	super(eventBus, view, proxy);
	this.ganttPresenter = ganttPresenter;
	getView().setUiHandlers(this);
	getView().startProcessing();
    }

    @Override
    public void showGanttPopup(Widget widget) {
	ganttPresenter.schedulerToGantt();
	ganttPresenter.forceReveal();
    }

    @Override
    protected void revealInParent() {
    }
}
